//
//  UserInfo.m
//  ZQ
//
//  Created by 掌兴 on 14-8-15.
//  Copyright (c) 2014年 掌兴. All rights reserved.
//

#import "UserInfo.h"

@implementation UserInfo

@synthesize userDefaults = _userDefaults;
+(UserInfo *)SharedUserfo
{
    static UserInfo * _userInfo = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _userInfo = [[UserInfo alloc] init];
    });
    return _userInfo;
}

- (id)init
{
    self = [super init];
    if (self == nil)
        return nil;
    self.userDefaults = [NSUserDefaults standardUserDefaults];
    return self;
}
-(BOOL)save
{
    return [self.userDefaults synchronize];
}

-(BOOL)isLogin{
    NSString *userToken=[self user_token];
    if (userToken&&userToken.length>0) {
        return YES;
    }else{
        return NO;
    }
}


-(void)setUser_token:(NSString *)user_token{
   [self.userDefaults setValue:user_token forKey:@"user_token"];
   [self save];
}
-(NSString*)user_token{
    return [self.userDefaults objectForKey:@"user_token"];
}
@end
